package com.hsgene.order.condition;

import com.hsgene.common.util.date.SimpleDateUtils;
import com.hsgene.common.util.date.TimeJsonDeserializer;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * @description: 机构订单列表查询条件
 * @projectName: hdas-geneshop-server
 * @package: com.hsgene.order.condition
 * @author: maodi
 * @createDate: 2019/1/16 9:58
 * @version: 1.0
 * Copyright: Copyright (c) 2019
 */
public class AgencyOrderCondition implements Serializable {
    private static final long serialVersionUID = -3483906875382551475L;

    /**
     * 订单编号
     */
    private String orderNo;

    /**
     * 申请单编号
     */
    private String requisitionNo;

    /**
     * 患者姓名
     */
    private String patientName;

    /**
     * 下单开始日期
     */
    private Date startDate;

    /**
     * 下单结束日期
     */
    private Date endDate;

    /**
     * 订单状态(7-待确认样本,9-待上传报告)
     */
    private Integer orderStatus;

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getRequisitionNo() {
        return requisitionNo;
    }

    public void setRequisitionNo(String requisitionNo) {
        this.requisitionNo = requisitionNo;
    }

    public String getPatientName() {
        return patientName;
    }

    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDateStr) {
        if (StringUtils.isNotBlank(startDateStr)) {
            if (TimeJsonDeserializer.matchStandardPattern(startDateStr)) {
                this.startDate = SimpleDateUtils.parseDate(startDateStr, SimpleDateUtils.DatePattern.STANDARD_PATTERN
                        .toString());
            } else {
                this.startDate = SimpleDateUtils.parseDate(startDateStr, SimpleDateUtils.DatePattern.YYYY_MM_DD.toString
                        (), SimpleDateUtils.HourMinSecondFormat.MID_NIGHT);
            }
        }
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDateStr) {
        if (StringUtils.isNotBlank(endDateStr)) {
            if (TimeJsonDeserializer.matchStandardPattern(endDateStr)) {
                this.endDate = SimpleDateUtils.parseDate(endDateStr, SimpleDateUtils.DatePattern.STANDARD_PATTERN
                        .toString());
            } else {
                this.endDate = SimpleDateUtils.parseDate(endDateStr, SimpleDateUtils.DatePattern.YYYY_MM_DD.toString(),
                        SimpleDateUtils.HourMinSecondFormat.TODAY_END);
            }
        }
    }

    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }
}
